export function spawn(cmd: string, args?: string[]): Promise<string> {
  return ipc.invoke("cp:spawn", cmd, args);
}

/**
 * 以管理员权限运行命令
 * @param cmd
 * @param args
 * @param id
 */
export function sudo(cmd: string, args?: string[], id?: string) {
  return ipc.invoke("cp:sudo", `${cmd} ${args?.join(" ")}`.trim(), id);
}

/**
 * 创建软链接
 * @param source
 * @param linkPath
 * @param id
 */
export function mklinkDir(source: string, linkPath: string, id?: string) {
  return sudo("mklink", ["/D", `"${linkPath}"`, `"${source}"`], id);
}

/**
 * 打开系统高级属性
 */
export function openSystemPropertiesAdvanced() {
  return sudo("C:\\Windows\\System32\\SystemPropertiesAdvanced.exe", undefined, "open-system-properties-advanced");
}
